home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGASIC
/
BASFILES.LZH
/
DIALOG.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-09-10
|
3KB
|
146 lines
'$INCLUDE:'QBTOOLS.INC'
'' '$INCLUDE: 'qbtools2.inc'
'DIM Ques$(10)
'Ques$(1) = "This is a test to see how the"
'Ques$(2) = "dialog box works. The next line is the input."
'Ques$(3) = "It is important to see how this follows on from the"
'Ques$(4) = "input. Both these lines, and those before hand"
'Ques$(5) = "should be left justified."
'Ques$(6) = "Heres More"
'Ques$(7) = "Heres More again"
'Before% = 4
'After% = 3
'sect% = 2
'Ffgd% = 7
'Fbgd% = 0
'Gfgd% = 7
'Gbgd% = 0
'Length% = 62
'DialogBox Ques$(), Before%, After%, Length%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer$, Ek%
'FOR sect% = 0 TO 2
'Ques$(1) = "Enter your FIRST name."
'Ques$(2) = "The data file will also"
'Ques$(3) = "receive this name."
'Before% = 1
'After% = 2
'Ffgd% = 7
'Fbgd% = 0
'Gfgd% = 7
'Gbgd% = 0
'Length% = 12
'DialogBox Ques$(), Before%, After%, Length%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer$, Ek%
'NEXT sect%
'END
SUB DialogBox (Ques$(), Before%, After%, Length%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer$, Ek%)
'
' Before - Textlines for question before input
' After - Textlines for question after input
' Length - Length of input
' Ffgd - Frame foreground
' Fbgd - Frame background
' Gfgd - General Foreground
' Gbgd - General background
' Sect - Section of the screen to display on
' 0=Top,1=Center,2=Bottom
' Answer - Answer string
' Ek - Exit Key
' 5=Return, 7=ESC
'$DYNAMIC
REDIM Saver%(2000)
BandA% = Before% + After%
height% = BandA% ' Pure Text height
height% = height% + 5 ' 4 lines of drawing + input line
IF height% > 25 THEN
EXIT SUB
END IF
IF Length% < 1 THEN
EXIT SUB
END IF
SELECT CASE sect%
CASE 0
Begin% = 1
CASE 1
Begin% = (25 - height%) / 2
CASE 2
Begin% = (25 - height%) + 1
CASE ELSE
EXIT SUB
END SELECT
SaveScreen Saver%(1)
Txwd% = Length%
FOR j% = 1 TO BandA%
Trim Ques$(j%)
IF LEN(Ques$(j%)) > Txwd% THEN
Txwd% = LEN(Ques$(j%))
END IF
NEXT j%
BoxWidth% = Txwd% + 4
LeftCol% = (80 - BoxWidth%) / 2
Wid% = BoxWidth%
FrameType% = 3
FrmFgd% = Ffgd%
FrmBgd% = Fbgd%
Fill% = 1
FillFgd% = Gfgd%
FillBgd% = Gbgd%
DrawBox Begin%, LeftCol%, Wid%, height%, FrameType%, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
Attrib1% = Attributes%(Gfgd%, Gbgd%, 0, 0)
Attrib2% = Attributes%(Ffgd%, Fbgd%, 0, 0)
FOR j% = 1 TO Before%
text$ = Ques$(j%)
ColorPrint text$, Begin% + j%, LeftCol% + 2, Attrib1%
NEXT j%
FOR j% = 1 TO After%
text$ = Ques$(j% + Before%)
ColorPrint text$, Begin% + Before% + 3 + j%, LeftCol% + 2, Attrib1%
NEXT j%
Istart% = (80 - Length%) / 2
DrawBox Begin% + Before% + 1, Istart% - 1, Length% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
Xc% = LeftCol% + 2
Yc% = Begin% + Before% + 2
TextInput 0, 0, 0, 0, 1, 0, 1, Length%, Answer$, Istart%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
RestoreScreen Saver%(1)
END SUB